/**
 * Copyright &copy; 2021-2026 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.servicecenter.service.dto;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.annotation.ExcelProperty;
import com.jeeplus.core.query.Query;
import com.jeeplus.servicecenter.domain.AssociationApply;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 用户Entity
 *
 * @author jeeplus
 * @version 2021-12-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class AssociationApplyDTO {

    /**
     * id
     */
    @NotNull(message = "公司不能为空")
    private String id;

    /**
     * 登录名
     */
    @Length(min = 1, max = 100)
    @Query
    @ExcelProperty("申请登录名")
    private String loginName;
    /**
     * 当前登录名
     */
    @ExcelProperty("当前登录名")
    private String currentLoginName;

    /**
     * 用户姓名
     */
    @Query
    @ExcelProperty("用户姓名")
    private String name;

    /**
     * 归属公司
     */
    @NotNull(message = "公司不能为空")
    private String companyId;

    /**
     * 归属部门
     */
    @NotNull(message = "部门不能为空")
    private String officeId;

    /**
     * 备注
     */
    @ExcelProperty("备注")
    private String remarks;


    /**
     * 职位
     */

    private String roleId;

    /**
     * 岗位
     */

    private String postId;

    public AssociationApply getAssociationApply(){
        AssociationApply associationApply = BeanUtil.copyProperties(this, AssociationApply.class);
        associationApply.setApplyTime(new Date());
        associationApply.setResult("未处理");
        return associationApply;
    }

    public Boolean isCheckLoginName(){
        return loginName.equals(currentLoginName);
    }

}
